<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

    
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<%@ include file="/WEB-INF/component/commonCSS.jsp" %> 

<style type="text/css">
    	div.col-sm-3.text-left,div.col-sm-5.text-left,div.col-sm-10.text-left{
    	    color:#949494;
    	}
    	label.checkLong *{
    		vertical-align: middle;
    		margin: 0px;
    	}
</style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    
    <section class="content-header">
        <h1 >撤销已申报短缺药品</h1>
         <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
              <li><a href="#">交易</a></li>
              <li><a href="#">药品短缺管理</a></li>
			  <li><a href="#">药品短缺查看</a></li>
        </ol> 
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <!-- form start -->
            <form role="form" id="form" class="form-horizontal"  method="post">
            	<input hidden id='shortmedicine_id' name='shortmedicine_id' value='<c:out value="${info.shortmedicine_id}" />' >
            	
                <div class="box-body">
	                
                      
                      
	                   <div class="form-group form-group-xs">
	                        <label class="col-sm-2 text-right">撤销原因<spring:message code="message.yanZheng.maoHao"/></label>
	                        <div class="col-sm-9 text-left">
	                        	   <textarea rows="3" class="form-control" id="cancel_remark" name="cancel_remark" maxlength="2000" ></textarea> 
	                        </div>
	                        
	                   
	                   
                </div>
               </div>
            </form>
            <div class="box-footer text-center">
               		 <button type="button" onclick="submitCancel();" class="btn btn-success btn-sm">撤&nbsp;销</button>
                    <button type="button" onclick="back();" class="btn btn-danger btn-sm">返&nbsp;回</button>
               </div>
        </div>
    </section>
</body>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">
		function back(){
		   	window.location.href="${ctx}/DrugShortage/toList.html";
		   }


	
		function submitCancel(){
			if(!valid()){
				return;
			}
	 		$.HN.message.confirm('确定提交吗？', '', '').on(function (e) {
    			if (e) {
    				var cancel_remark =$('#cancel_remark').val();
    				var shortmedicine_id =$('#shortmedicine_id').val();
    				var postData ={
    						cancel_remark:cancel_remark,
    						shortmedicine_id:shortmedicine_id
    				};
    	    		$.post("${ctx}/DrugShortage/updateShortageBySS.html",postData, function(result) {
    	    			if (result.success) {
    	    				$.HN.message.alert("操作成功！", "消息", "success");
    	    				window.location.href="${ctx}/DrugShortage/toList.html";
    	    			} else {
    	    				$.HN.message.alert("操作失败！", "消息", "error");
    	    				window.location.href="${ctx}/DrugShortage/toCancel.html";
    	    			}
    	    		}, "json")
    			}
    		}); 
		}
	
	function valid(){
		var cancel_remark =$('#cancel_remark').val();
		if(cancel_remark=null || cancel_remark==""){
			 top.$.alert('请输入撤销备注','warn');
			 $('#cancel_remark').focus();
			 return false;
		}
		 return true;
	}
	 function back(){
		   	window.location.href="${ctx}/DrugShortage/toList.html";
		   }
</script>
</html>